package com.atguigu.oss.controller;

import com.atguigu.commonutils.R;
import com.atguigu.oss.service.OssService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Api(tags="阿里云文件管理")
@RestController
//@CrossOrigin
@RequestMapping("/eduoss/fileoss")
public class OssController {
    @Autowired
    private OssService ossService;

    @PostMapping("/upload")
    public R uploadAvatar(@RequestParam("file") MultipartFile file){
        String url = ossService.uploadAvatar(file);
        return R.ok().data("url", url).message("上传成功uwu");
    }
}
